import { stringify } from 'qs';
import request from '@/utils/request';
import { getPageSize } from '@/utils/common';

//一、配件库管理：
//1、列表
export async function selectPartsList(params) {
  params.pageSize = params.pageSize || getPageSize();
  return request(
    `/server/api/tms/tms-parts/selectTmsPartsHierList`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
//2、详情
export async function partsDetails(params) {
  return request(`/server/api/tms/tms-parts/viewTmsPartsDetails`, {
    method: 'POST',
    body: params,
  });
}
/**
 * 3、新增编辑
 */
export async function partsOperate(params) {
  const url = params.id ? 'tms-parts/updateTmsParts' : 'tms-parts/insertTmsParts';
  return request(
    `/server/api/tms/${url}`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}

//4、删除：
export async function deleteParts(params) {
  return request(`/server/api/tms/tms-parts/deleteTmsParts`, {
    method: 'POST',
    body: params,
  });
}

// 5、供应商列表：
export async function selectPartsSuppliersList(params) {
  params.pageSize = params.pageSize || getPageSize();
  return request(`/server/api/tms/tms-parts-offer-relation/selectTmsPartSuppliersList`, {
    method: 'POST',
    body: params,
  });
}
